import { createRouter, createWebHashHistory } from "vue-router";
import QuickView from "@renderer/view/quick/QuickView.vue";
import MprView from "@renderer/view/normal/mpr/MprView.vue";
import EmptyView from "@renderer/view/homePage/EmptyView.vue";
import Home from "@renderer/view/homePage/Home.vue";
import { EnumViewMode, EnumViewType } from "@renderer/assets/types";
import ThreedView from "@renderer/view/ThreedView.vue";
import TagPage from "@renderer/view/tagPage/TagPage.vue";
import SettingPage from "@renderer/view/settingPage/SettingPage.vue";
const routes = [
  {
    path: "/",
    name: "home",
    component: Home,
    children: [
      {
        path: `${EnumViewMode.quick}/:seriesId`,
        name: EnumViewMode.quick,
        component: QuickView,
      },
      {
        path: `${EnumViewMode.normal}/:seriesId`,
        name: EnumViewMode.normal,
        component: MprView,
      },
      {
        path: `${EnumViewType.threeD}/:seriesId`,
        name: EnumViewType.threeD,
        component: ThreedView,
      },
      {
        path: `tag/:seriesId`,
        name: 'tag',
        component: TagPage,
      },
      {
        path: `setting`,
        name: 'setting',
        component: SettingPage,
      },
      {
        path: "",
        name: "empty",
        component: EmptyView,
      },
    ],
  },
];

const router = createRouter({
  // 4. 内部提供了 history 模式的实现。为了简单起见，我们在这里使用 hash 模式。
  history: createWebHashHistory(),
  routes: routes, // `routes: routes` 的缩写
});
router.beforeEach(async (to, from, next) => {
  console.log(`to ${to.path}`, `from ${from.path}`);
  next();
});
export { router, routes };
